package com.igoal.entity;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class UserSchoolPk implements Serializable {

	private static final long serialVersionUID = 847180838650620832L;
	private User user;
	private School school;

	public UserSchoolPk() {
	}
	@ManyToOne
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	@ManyToOne
	public School getSchool() {
		return school;
	}

	public void setSchool(School school) {
		this.school = school;
	}

	public boolean equals(Object other) {
		if ((this == other))
			return true;
		if ((other == null))
			return false;
		if (!(other instanceof UserSchoolPk))
			return false;
		UserSchoolPk castOther = (UserSchoolPk) other;

		return (this.user.getId() == castOther.user.getId())
				&& (this.school.getId() == castOther.school.getId());
	}

	public int hashCode() {
		int result = 17;

		result = 37 * result + (int) this.user.getId().intValue();
		result = 37 * result + (int) this.school.getId().intValue();
		return result;
	}

}
